<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/template/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__STATIC__/template/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__STATIC__/template/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->

    <title>产品列表</title>
    <!--<link rel="stylesheet" href="__STATIC__/template/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">-->
</head>
<body class="pos-r">
<style>
    #DataTables_Table_0_info {
        display: none;
    }
    #DataTables_Table_0_paginate{
        display: none;
    }
    /*分页样式*/
    .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
    .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
    .pagination .active{background-color: #46A3FF;color: #fff;}
    .pagination .disabled{color:#aaa;}
    a:hover{color: #ff081f; /*鼠标在a上面时,变蓝色*/}
</style>
<!--<div class="pos-a" style="width:200px;left:0;top:0; bottom:0; height:100%; border-right:1px solid #e5e5e5; background-color:#f5f5f5; overflow:auto;">
	<ul id="treeDemo" class="ztree"></ul>
</div>-->
<div style="">
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span> 商品管理
        <span class="c-gray en">&gt;</span> <span style="color: red">过期商品列表</span>
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <div class="page-container">
        <div class="text-c">
             <span class="select-box" style="width:180px;">
				  <select class="select" id="opt" name="opt">
                      <option value="1">商品分类搜索</option>
                      <option value="2">商品标题搜索</option>
                  </select>
			</span>
            <span class="select-box" style="width:120px;" id="type_s">
				  <select class="select" id="goodsType" name="goodsType">
                      {notempty name='gt_id'}
                          {foreach name="category" id="v"}
                          <option value="{$v.id}" {$v.id==$gt_id ? 'selected = selected':'' }>{$v.name}</option>
                          {/foreach}
                      {else /}
                          {foreach name="category" id="v"}
                          <option value="{$v.id}">{$v.name}</option>
                          {/foreach}
                      {/notempty}
                  </select>
			</span>
            <input type="text" value="{$goods_title ? $goods_title : ''; }" class="input-text" style="width:250px;display: none" placeholder="商品标题" id="goods_title" name="goods_title" >

            <button type="submit" class="btn btn-success" id="find"  name="submit" >
                <i class="icon-search"></i> 搜产品
            </button>

        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20" id="load">
			<span class="l">
				<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius">
                    <i class="Hui-iconfont" >&#xe6e2;</i> 批量删除
                </a>
			</span> <span class="r">共有数据：<strong>{$count}</strong> 条</span>
        </div>
        <div class="mt-20" id="replace">
            <table class="table table-border table-bordered table-bg table-hover table-sort" >
                <thead>
                <tr class="text-c">
                    <th width="40">
                        <input name="" type="checkbox" value="0" class="productCheck">
                    </th>
                    <th width="50">商品表ID</th>
                    <th width="100">淘宝/天猫商品ID</th>
                    <th width="60">缩略图</th>
                    <th width="100">商品标题</th>
                    <th width="100">售价</th>
                    <th width="100">折扣价</th>
                    <th width="100">月销量</th>
                    <th width="100">佣金</th>
                    <th width="100">所属分类</th>
                    <th width="100">所属板块</th>
                    <th width="100">添加时间</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                {volist name='goods' id='v' empty='$empty'}
                <tbody>
                <tr class="text-c va-m">
                    <td style="vertical-align:middle">
                        <input name="" type="checkbox" value="{$v.id}" class="productCheck">
                    </td>
                    <th width="40" style="vertical-align:middle">{$v.id}</th>
                    <th width="40" style="vertical-align:middle">{$v.goods_id}</th>
                    <td style="vertical-align:middle">
                        <a href="{$v.goods_detail_url}">
                            <img width="60" class="product-thumb" src="{$v.goods_big_img}">
                        </a>
                    </td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_title}</td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_price?$v.goods_price:''}元</td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_z_price}元</td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_volume}</td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_yongjin}</td>
                    <td class="text-1" style="vertical-align:middle">{$v.gt_name?$v.gt_name:''}</td>
                    <td class="text-1" style="vertical-align:middle">{$v.gb_name?$v.gb_name:''}</td>
                    <td class="text-1" style="vertical-align:middle">{$v.goods_add_time|date='Y-m-d',###}</td>

                    <td class="td-manage " style="vertical-align:middle">
                        <a style="text-decoration:none" class="ml-5" onClick="product_del(this,'{$v.id}')" href="javascript:;" title="删除">
                            <i class="Hui-iconfont">&#xe6e2;</i>
                        </a>
                    </td>
                </tr>
                </tbody>
                {/volist}
            </table>
            <div class="col-md-8 col-xs-6">{$goods->render()}</div>
        </div>

    </div>

</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__STATIC__/template/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__STATIC__/template/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/template/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

    $(document).ready(function(){

        $('#find').click(finduser);//搜索提交
        $('#opt').change(search_item)
    });

    /* 搜索 项*/
    function search_item(){
        var opt = $('#opt').val();
        if(opt==1){
            $('#type_s').show();
            $('#goods_title').hide();

        }else if(opt==2){
            $('#type_s').hide();
            $('#goods_title').show();

        }
    }
    /*产品-搜索*/
    function finduser(){
        //alert(1);
        var opt = $('#opt').val();
        var gt_id = $('#goodsType').val();
        var gt_name = $('#goodsType').find('option:selected').text();
        var goods_title = $('#goods_title').val();
       /* var datemin = $('#datemin').val();
        var datemax = $('#datemax').val();*/
        var url = "{:url('recovery_search')}";

        var data = {
            opt:opt,
            gt_id:gt_id,
            gt_name:gt_name,
            goods_title:goods_title
        }
        $.post(url,data,function(result){
            // console.log(result);
            if(result==false){
                layer.msg(result.msg,{icon:1,time:2000});
            }else{
                $("body").empty();
                $("body").append(result);
                if(opt==1){
                    $('#type_s').show();
                    $('#goods_title').hide();
                }else{
                    $('#type_s').hide();
                    $('#goods_title').show();
                }
            }

        })

    }


    /*产品-删除*/
    function product_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            var url ="{:url('admin/goods/product_del')}";
            $.post(url,{id:id },function(result){
                console.log(result);
                if(result.ok){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                }else{
                    layer.msg('删除失败!',{icon:1,time:2000});
                }
            })

        });
    }
    /*产品-批量删除*/
    function datadel(){
        //alert(1);
        var obj = document.getElementsByClassName('productCheck');
        var num = $('input[type=checkbox]:checked').length;
        if(num==0){
            layer.msg('未选取删除对象！',{icon:0,time:2000});
        }else{
            layer.confirm('批量删除须谨慎，是否删除？',function(){
                var arr = new Array();
                $.each($('input:checkbox:checked'),function(){
                    arr.push(parseInt($(this).val()));
                });
                var data = { id:arr };
               // alert(arr);
                $.post("{:url('admin/Goods/productDatadel')}",data,function(result){
                    console.log(result);
                    if(result.ok){
                        layer.msg(result.msg,{icon:1,time:1000});
                        setTimeout("window.location.replace(location.href)",1000);
                    }else{
                        layer.msg(result.msg,{icon:5,time:1000});
                    }
                });
            });


        }
    }
</script>
</body>
</html>